/**
 * @file main.js
 * @description 应用入口文件
 * @created 2024-03-20
 */

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import pinia from '@/stores/index'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/reset.css'
import * as Icons from '@ant-design/icons-vue'
import axios from 'axios'
import request from './utils/request'

// 创建应用实例
const app = createApp(App)

// 注册Element Plus图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 注册Ant Design Vue图标
for (const [key, component] of Object.entries(Icons)) {
  app.component(key, component)
}

// 使用 Pinia
app.use(pinia)
// 使用Ant
app.use(Antd)
// 使用路由
app.use(router)
//使用ElementPlus
app.use(ElementPlus)
app.mount('#app')

app.config.globalProperties.$axios = axios
app.config.globalProperties.$request = request
